package com.balloon.springboot.logger.service.impl;

import com.balloon.springboot.logger.dao.LoggerInfoDao;
import com.balloon.springboot.logger.entity.LoggerInfo;
import com.balloon.springboot.logger.service.LoggerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;



/**
 * 持久化存储日志 ServiceImpl
 *
 * @author liaofuxing
 * @date 2021/09/01 10:37
 */
@Service
public class LoggerInfoServiceImpl implements LoggerInfoService {

    @Autowired
    private LoggerInfoDao loggerInfoDao;


    /**
     * 保存日志
     *
     * @param loggerInfo 日志信息对象
     */
    @Override
    public void saveLoggerInfo(LoggerInfo loggerInfo) {
        loggerInfoDao.save(loggerInfo);
    }

    /**
     * 根据日志id 查询日志对象
     *
     * @param id 日志id
     * @return LoggerInfo 日志对象
     */
    @Override
    public LoggerInfo findByLoggerInfoId(String id) {
        return loggerInfoDao.findById(id).get();
    }
}
